package com.sx.pipeline.adapter

import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.hjq.widget.layout.CircleImageView
import com.noober.background.view.BLRelativeLayout
import com.sx.mvvmlibs.base.EasyAdapter
import com.sx.pipeline.R

/**
 * author : zhouyouqiang
 * e-mail : 1638473898@qq.com
 * date   : 2022/4/11 15:59
 * desc   : 选择银行卡
 * version: 1.0
 */
class ChooseBankCardAdapter(
    private val contexts: Context,
    private val footPrintData: List<String>,
) : EasyAdapter<String,ChooseBankCardViewHolder?>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ChooseBankCardViewHolder {
        val view = View.inflate(contexts, R.layout.item_choose_bank_card, null)
        return ChooseBankCardViewHolder(view)
    }

    override fun getItemCount(): Int {
        return footPrintData.size
    }

    override fun whenBindViewHolder(holder: ChooseBankCardViewHolder?, position: Int) {
         val data = footPrintData[position]
        holder!!.tabRoot.tag = position //绑定
        holder.tvName.text=data
    }
}

class ChooseBankCardViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
    var tabRoot: BLRelativeLayout = itemView.findViewById(R.id.tab_root)
    var ivLogo: CircleImageView = itemView.findViewById(R.id.iv_logo)
    var tvName: TextView = itemView.findViewById(R.id.tv_title)
}